// ==========================================================================
// Card (incl. Header and Expanded)
// ==========================================================================

.card {
    border-radius: 0px;
    font-family: $font;
    font-weight: 600;
    font-size: 13px;
    line-height: 18px;
    margin-bottom: 4px;
    position: relative;

    &.card--movable {
      cursor: move;
    }
    &.card--error {
        padding: 12px 20px;
        background-color: rgb(255, 176, 176);
    }
    .card__header {
        border: $cardBorderStyle;
        padding: 20px 40px 20px 75px;
        display: block;
        background: white;
        cursor: move;
        position: relative;
    }

    .bleeding-edge .card__header {
        padding-top: 5px;
        padding-bottom: 5px;
        border-width: 1px;
    }

    .card__text {
        margin:auto;
        display: inline-block;
        vertical-align: middle;
        width: 99%;
        position: relative;

        &.activated {
            color: #8595A5;
        }
        .card__buttons__multioptions {
            cursor: pointer;
            vertical-align: middle;
            text-align: right;
            position: absolute;
            left:-34px;
            top:50%;
            width: 32px;
            margin-top:-30px;
            padding-top: 22px;
            padding-bottom: 22px;
            .fa {
                width: 12px;
                font-size: 15px;
            }
        }
    }

    .card__header-title,
    .card__header-hint {
      &:focus {
        @include form-builder-focus();
      }
    }

    .card__header-title {
        color: $cool-gray;

        &:focus {
            color: $black;
          }

        // we use placeholder as error message, as empty title is not welcomed
         &::placeholder {
            color: $cool-red;
            background-color: rgba($cool-red, 0.075);
        }
    }

    .card__header-hint {
        color: inherit;
        font-weight: 400;

        &::placeholder {
            color: $cool-silver;
            font-style: italic;
        }
    }

    .card__header-subtitle {
        margin: 10px 0 0 0;
        color: #aaa;
        font-size: 12px;

        &:before {
            content: '+ ';
            opacity: 0.5;
        }
    }
    .card__header-subtitle-empty-value {
        border: 1px solid #ffdbdb;
        padding: 2px 3px;
        border-radius: 3px;
        background-color: #fff8f8;
    }
    .card__option-translation {
        &--empty {
            opacity: 0.6;
        }
    }
    &.card--shaded .card__header-title {
        opacity:0.3;
    }

    &--required {
        .card__text:after {
            content: '*';
            position: absolute;
            top: -0.15em;
            left: -9px;
            color: #bbb;
            font-size: 11px;
        }
        &.card--selectquestion {
            .card__text {
                padding-left: 10px;
                &:after {
                    left: 1px;
                }
            }
        }
    }
}

.bleeding-edge .card {
    margin-bottom: 0;
}

// pseudo-rule used only to increase card hover area to the left of the card
.no-touch .card:before {
    content: " ";
    height: 100%;
    left: -60px;
    position: absolute;
    width: 80px;
}

.card--placeholder {
    background-color: transparent;
    color:#8695A5;
    border:2px solid #8695A5;
    text-align: center;
    font-family: $font;
    font-weight: 600;
    padding: 20px;
    margin:20px 0px;
}

.sortable-active {
    .card__header {
        border: $cardInSortBorderStyle;
        .card__header-title {
            color: $cardInSortBorderColor;
        }
    }
}
.card--error {
    background-color: rgb(255, 176, 176);
}

// ==========================================================================
// Card indicator
// ==========================================================================

$cardIndicatorWidth: 42px;
$cardIndicatorIconHeight: 21px;
$cardIndicatorIconWidth: 21px;

.card__indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: $cardIndicatorWidth;
    height: 100%;
    border-right: $cardBorderStyle;
}
.card--insort {
    .card__indicator {
        border-right: $cardInSortThinBorderStyle;
    }
}
.card__indicator__icon {
    position: absolute;
    top: 50%;
    margin-top: -($cardIndicatorIconHeight/2);
    left: 8px;
    width: $cardIndicatorIconHeight;
    height: $cardIndicatorIconHeight;
    font-size: 20px;
    line-height: 20px;
    text-align: center;
    color: $indicatorColor;

    .fa.invert {
        padding: 3px 1px;
        font-size: 0.95em;
        background-color: #8595A5;
    }
    .fa-lato-range,
    .fa-lato-calculate,
    .fa-lato-decimal,
    .fa-lato-integer,
    .fa-lato-text {
        font-size: 15px;
        width: $cardIndicatorIconWidth;
    }
    .fa-lato-decimal {
        margin-left:2px;
    }
}

// ==========================================================================
// Card quick buttons
// ==========================================================================

.card__buttons {
    border: $cardBorderStyle;
    border-width: 0 0 0 1px;
    position: absolute;
    top: 0px;
    right: 2px;
    width: 25px;
    height: 100%;
    cursor: pointer;
    z-index: 3;

}

.card--shaded .card__buttons {
    border:none;
}

.bleeding-edge .card__buttons {
    width: 169px;
    right: -181px;
    background-color: white;
}
// ==========================================================================
// Card Shade (displays on hover above the card header)
// ==========================================================================

// Displayed when parent .card has .card--shaded
.card__header--shade {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0px;
    top: 0px;
    z-index: 2;
    text-align: center;
    vertical-align: middle;
    display: none;
    span {
        position: relative;
        top: 35%;
        font-weight: 600;
        font-size: 23px;
    }
}

.card--shaded .card__header--shade {
    display: block;
    > span:after {
        content: attr(data-card-hover-text);
    }
}
.card__header.settings .card__header--shade {
    background: rgba(#858F98, 0.6);
}
.card__header.delete .card__header--shade {
    background: rgba(#D08B8C, 0.6);
}
.card__header.duplicate .card__header--shade {
    background:rgba($linkColor, 0.6);
}
.card__header.add-to-library .card__header--shade {
    background: rgba(#39BF6E, 0.6);
}

.card--insort {
    .card__buttons {
        border-left: $cardInSortThinBorderStyle;
    }
}
.card__buttons__button {
    height: 20px;
    line-height: 20px;
    width: 26px;
    position: absolute;
    right: -2px;
    bottom: 0px;
    text-align: center;
    &.card__buttons__button--gray {
        color: #858F98;
        top:0px;
    }
    &.card__buttons__button--red {
        color: #D08B8C;
        top:37%;
        margin-top:-10px;
    }
    &.card__buttons__button--blue {
        color:$linkColor;
    }
    // &.card__buttons__button--add {
    //   bottom: 22%;
    // }
    &.card__buttons__button--copy {
        bottom: 26%;
    }
    &.card__buttons__button--activated {
        // trying to transition this into %activated-card-button
        color: #646D75;
        background-color: #D9DDE1;
        opacity: 1;
    }
    &:hover, &.card__buttons__button--activated:hover {
        opacity: 0.5;
        // @extend %activated-card-button;
        // background: none;
        // color: white;
    }

}

.bleeding-edge .card__buttons__button {
    position: relative;
    float: left;
    width: 30px;
    display: block;
    margin: 5px;
    &.card__buttons__button--red,
      &.card__buttons__button--gray,
      &.card__buttons__button--blue,
      &.card__buttons__button--gray-green,
      &.card__buttons__button--copy {
        top: 0;
    }
}
// Misc...

.placeholder {
    height: 80px;
    margin-bottom: 10px;
    border: 2px solid #B4C1CD;
    border-radius: 4px;
    position: relative;
    &:before {
        content: "Drag and drop to reorder. ";
        position: absolute;
        font-weight: bold;
        color: #8595A5;
        width: 100%;
        text-align: center;
        line-height: 75px;
        font-size: 14px;
    }
}

// overrides
// ---------

.card--shaded {
    .card__buttons {
        z-index: 4;
    }
    .card__header .card__text .bg {
        display: block;
    }
}

.survey-editor--singlequestion .card__buttons__button--delete {
    display: none;
}

.survey-editor--singlequestion .survey-editor__action--multiquestion {
    display: none;
}
